<%--
  Created by IntelliJ IDEA.
  User: 16420
  Date: 2022/5/13
  Time: 21:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>

</head>

<body>
<div class="x-body">

    <form class="layui-form">
        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">
                <span class="x-red">*</span>客户Id
            </label>
            <div class="layui-input-inline">
                <input type="text" id="customerId" name="customerId" required=""
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">
                <span class="x-red">*</span>客户姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="customerName" name="customerName" required=""
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">
                <span class="x-red">*</span>客户性别
            </label>
            <div class="layui-input-inline">
                <input type="text" id="vipCustomerSex" name="vipCustomerSex" required=""
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">
                <span class="x-red">*</span>客户年龄
            </label>
            <div class="layui-input-inline">
                <input type="text" id="vipCustomerAge" name="vipCustomerAge" required="" lay-verify=""
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="email" class="layui-form-label">
                <span class="x-red">*</span>线索
            </label>
            <div class="layui-input-inline">
                <input type="text" id="cueSource" name="cueSource" required="" lay-verify=""
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="userName" class="layui-form-label">
                <span class="x-red">*</span>收入来源
            </label>
            <div class="layui-input-inline">
                <input type="text" id="incomeLevel" name="incomeLevel" required="" lay-verify=""
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="userPwd" class="layui-form-label">
                <span class="x-red">*</span>婚姻
            </label>
            <div class="layui-input-inline">
                <input type="text" id="maritalStatus" name="maritalStatus" required="" lay-verify=""
                       autocomplete="off" class="layui-input">
            </div>

        </div>

        <div class="layui-form-item">
            <label for="userPwd" class="layui-form-label">
                <span class="x-red">*</span>电话
            </label>
            <div class="layui-input-inline">
                <input type="text" id="tel" name="tel" required="" lay-verify=""
                       autocomplete="off" class="layui-input">
            </div>

        </div>

        <div class="layui-form-item">
            <label for="userPwd" class="layui-form-label">
                <span class="x-red">*</span>电子邮箱
            </label>
            <div class="layui-input-inline">
                <input type="text" id="mail" name="mail" required="" lay-verify=""
                       autocomplete="off" class="layui-input">
            </div>

        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button class="layui-btn" lay-filter="add" lay-submit="">
                修改
            </button>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form
            , layer = layui.layer;

        //自定义验证规则
        form.verify({
            nikename: function (value) {
                if (value.length < 5) {
                    return '用户名至少得5个字符啊';
                }
            }
            , pass: [/(.+){6,12}$/, '密码必须6到12位']

        });

        //监听提交
        form.on('submit(add)', function (data) {
            console.log(data);
            //发异步，把数据提交给服务器
            $.ajax({
                url: "/vipAjax/update",
                type: "get",
                data: data.field,
                dataType: "json",
                success: function (rs) {
                    console.log(rs);

                    layer.alert(rs.info, {icon: 6}, function () {
                        if (rs.success) {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            //刷新
                            parent.window.loadData();
                        }

                    });

                }

            })

            return false;
        });


    });

    //取出本体存储的值
    function getLocalStorge() {
        //
        $("#customerId").val(localStorage.getItem("customerId"));
        $("#customerName").val(localStorage.getItem("customerName"));
        $("#vipCustomerSex").val(localStorage.getItem("vipCustomerSex"));
        $("#vipCustomerAge").val(localStorage.getItem("vipCustomerAge"));
        $("#cueSource").val(localStorage.getItem("cueSource"));
        $("#incomeLevel").val(localStorage.getItem("incomeLevel"));
        $("#maritalStatus").val(localStorage.getItem("maritalStatus"));
        $("#tel").val(localStorage.getItem("tel"));
        $("#mail").val(localStorage.getItem("mail"));
    }

    $(function () {
        getLocalStorge();
    })
</script>
<script>var _hmt = _hmt || [];
(function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>
